home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 1 / MacMania 1.toast / Hypercard / HyperCard' More / C-D / CheckWriter / Check Register / card_5803.txt < prev    next >
Encoding:
Text File  |  1987-12-02  |  6.8 KB  |  262 lines

  1. -- card: 5803 from stack: in
  2. -- bmap block id: 6513
  3. -- flags: 0000
  4. -- background id: 3854
  5. -- name: Balance
  6. ----- HyperTalk script -----
  7. on openCard
  8.   tabKey
  9. end openCard
  10.  
  11. on balance
  12.   global FirstRow,NbrCols,LastRow,PayCol,DepCol,BalCol
  13.   set cursor to 4
  14.   set numberFormat to "0.00"
  15.   put 4 into XCol
  16.   put empty into card field "Checks Out"
  17.   put empty into card field "Deps Out"
  18.   put zero into card field "Total Deps"
  19.   put zero into card field "Total Checks"
  20.   get card field "Balance" of first card
  21.   delete first char of it -- Get rid of "$".
  22.   put it into card field "Book Balance Is"
  23.   put empty into card field "Book Balance SB"
  24.   put empty into card field "Error"
  25.   repeat with j = (the number of first card of bkgnd "CheckReg") to (the number of last card of bkgnd "CheckReg")
  26.     put FirstRow into i
  27.     set lockMessages to true
  28.     repeat
  29.       if i > LastRow then exit repeat
  30.       set lockScreen to true
  31.       go to card j
  32.       if field (i + XCol) is empty then
  33.         get field (i + DepCol)
  34.         if it is not empty then
  35.           put field (i + 1) into dat
  36.           if length(dat) < 12 then put space before char 8 of dat
  37.           put right(field i,5) && dat && left(first line of field (i + 2),35) && right(it,9) & return into linex
  38.           go to card "Balance"
  39.           set lockScreen to false
  40.           put (((the number of lines in card field "Deps Out") + 1) * (the textHeight of card field "Deps Out") + 8) - ((item 4 of the rect of card field "Deps Out") - (item 2 of the rect of card field "Deps Out")) into scrollx
  41.           if scrollx < 0 then put 0 into scrollx
  42.           set scroll of card field "Deps out" to scrollx
  43.           put linex after card field "Deps Out"
  44.           add it to card field "Total Deps"
  45.           set lockScreen to true
  46.           go to card j
  47.         end if
  48.         get field (i + PayCol)
  49.         if it is not empty then
  50.           put field (i + 1) into dat
  51.           if length(dat) < 12 then put space before char 8 of dat
  52.           put right(field i,5) && dat && left(first line of field (i + 2) ,35) && right(it,9) & return into linex
  53.           go to card "Balance"
  54.           set lockScreen to false
  55.           put (((the number of lines in card field "Checks Out") + 1) * (the textHeight of card field "Checks Out") + 8) - ((item 4 of the rect of card field "Checks Out") - (item 2 of the rect of card field "Checks Out")) into scrollx
  56.           if scrollx < 0 then put 0 into scrollx
  57.           set scroll of card field "Checks out" to scrollx
  58.           put linex after card field "Checks Out"
  59.           add it to card field "Total Checks"
  60.           --set lockScreen to true
  61.           --go to card j
  62.         end if
  63.       end if
  64.       go to card "Balance"
  65.       set lockScreen to false
  66.       add NbrCols to i
  67.     end repeat
  68.     set lockMessages to false
  69.   end repeat
  70.   totals
  71. end balance
  72.  
  73. on totals
  74.   set numberFormat to "0.00"
  75.   get card field "Stmt Balance"
  76.   if it is empty then get zero
  77.   add (card field "Total Deps") - (card field "Total Checks") to it
  78.   put it into card field "Book Balance SB"
  79.   get it - (card field "Book Balance Is")
  80.   if it is zero then get "** Zero **"
  81.   if first char of it is not "-" then put "+" before it
  82.   put it into card field "Error"
  83. end totals
  84.  
  85. function left s,n,c
  86. if c is empty then put space into c
  87. repeat
  88.   if length(s) >= n then exit repeat
  89.   put c after s
  90. end repeat
  91. return char 1 to n of s
  92. end left
  93.  
  94. function right s,n,c
  95. if c is empty then put space into c
  96. repeat
  97.   if length(s) >= n then exit repeat
  98.   put c before s
  99. end repeat
  100. return char length(s) - n + 1 to length(s) of s
  101. end right
  102.  
  103.  
  104.  
  105.  
  106. -- part 1 (field)
  107. -- low flags: 01
  108. -- high flags: 2007
  109. -- rect: left=13 top=59 right=135 bottom=497
  110. -- title width / last selected line: 0
  111. -- icon id / first selected line: 0 / 0
  112. -- text alignment: 0
  113. -- font id: 4
  114. -- text size: 12
  115. -- style flags: 0
  116. -- line height: 16
  117. -- part name: Checks Out
  118.  
  119.  
  120. -- part 2 (field)
  121. -- low flags: 01
  122. -- high flags: 2007
  123. -- rect: left=13 top=157 right=233 bottom=497
  124. -- title width / last selected line: 0
  125. -- icon id / first selected line: 0 / 0
  126. -- text alignment: 0
  127. -- font id: 4
  128. -- text size: 12
  129. -- style flags: 0
  130. -- line height: 16
  131. -- part name: Deps Out
  132.  
  133.  
  134. -- part 3 (field)
  135. -- low flags: 01
  136. -- high flags: 0002
  137. -- rect: left=350 top=134 right=153 bottom=477
  138. -- title width / last selected line: 0
  139. -- icon id / first selected line: 0 / 0
  140. -- text alignment: 65535
  141. -- font id: 4
  142. -- text size: 12
  143. -- style flags: 256
  144. -- line height: 16
  145. -- part name: Total Checks
  146.  
  147.  
  148. -- part 4 (field)
  149. -- low flags: 01
  150. -- high flags: 0002
  151. -- rect: left=350 top=232 right=251 bottom=477
  152. -- title width / last selected line: 0
  153. -- icon id / first selected line: 0 / 0
  154. -- text alignment: 65535
  155. -- font id: 4
  156. -- text size: 12
  157. -- style flags: 256
  158. -- line height: 16
  159. -- part name: Total Deps
  160.  
  161.  
  162. -- part 5 (field)
  163. -- low flags: 01
  164. -- high flags: 0000
  165. -- rect: left=240 top=261 right=280 bottom=332
  166. -- title width / last selected line: 0
  167. -- icon id / first selected line: 0 / 0
  168. -- text alignment: 65535
  169. -- font id: 4
  170. -- text size: 12
  171. -- style flags: 256
  172. -- line height: 16
  173. -- part name: Book Balance Is
  174.  
  175.  
  176. -- part 6 (field)
  177. -- low flags: 00
  178. -- high flags: 0002
  179. -- rect: left=240 top=244 right=263 bottom=332
  180. -- title width / last selected line: 0
  181. -- icon id / first selected line: 0 / 0
  182. -- text alignment: 65535
  183. -- font id: 4
  184. -- text size: 12
  185. -- style flags: 256
  186. -- line height: 16
  187. -- part name: Stmt Balance
  188. ----- HyperTalk script -----
  189. on closeField
  190.   totals
  191. end closeField
  192.  
  193.  
  194.  
  195. -- part 7 (button)
  196. -- low flags: 00
  197. -- high flags: 2000
  198. -- rect: left=454 top=295 right=317 bottom=490
  199. -- title width / last selected line: 0
  200. -- icon id / first selected line: 6720 / 6720
  201. -- text alignment: 1
  202. -- font id: 0
  203. -- text size: 12
  204. -- style flags: 0
  205. -- line height: 16
  206. -- part name: Return
  207. ----- HyperTalk script -----
  208. on mouseUp
  209.   visual effect iris close
  210.   go to first card
  211. end mouseUp
  212.  
  213.  
  214.  
  215. -- part 8 (button)
  216. -- low flags: 00
  217. -- high flags: 8003
  218. -- rect: left=365 top=261 right=283 bottom=495
  219. -- title width / last selected line: 0
  220. -- icon id / first selected line: 0 / 0
  221. -- text alignment: 1
  222. -- font id: 0
  223. -- text size: 12
  224. -- style flags: 0
  225. -- line height: 16
  226. -- part name: Compute Balance
  227. ----- HyperTalk script -----
  228. on mouseUp
  229.   set hilite of the target to true
  230.   balance
  231.   set hilite of the target to false
  232. end mouseUp
  233.  
  234.  
  235.  
  236. -- part 9 (field)
  237. -- low flags: 01
  238. -- high flags: 0000
  239. -- rect: left=240 top=279 right=298 bottom=332
  240. -- title width / last selected line: 0
  241. -- icon id / first selected line: 0 / 0
  242. -- text alignment: 65535
  243. -- font id: 4
  244. -- text size: 12
  245. -- style flags: 256
  246. -- line height: 16
  247. -- part name: Book Balance SB
  248.  
  249.  
  250. -- part 10 (field)
  251. -- low flags: 01
  252. -- high flags: 0000
  253. -- rect: left=240 top=297 right=316 bottom=332
  254. -- title width / last selected line: 0
  255. -- icon id / first selected line: 0 / 0
  256. -- text alignment: 65535
  257. -- font id: 4
  258. -- text size: 12
  259. -- style flags: 256
  260. -- line height: 16
  261. -- part name: Error
  262.